import {
	observer
} from 'mobx-react';
import {
	WeaAlertPage,
	WeaLocaleProvider,
} from 'ecCom';
import {
	Spin
} from 'antd';
const getLabel = WeaLocaleProvider.getLabel;

@observer
export default class Authority extends React.Component {
	render() {
		const {
			store
		} = this.props, {
			loading,
			hasRight,
		} = store;

		const style = {
			position: 'absolute',
			top: '50%',
			left: '50%',
			marginLeft: -16,
			marginTop: -16,
		}

		if (loading) {
			return (
				<div style={style}>
					<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@3zw5ih`} spinning={true} size='large'></Spin>
				</div>
			)
		}

		if (hasRight) {
			return this.props.children;
		} else {
			return (
				<div style={{height:'100%'}}>
	                <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@g7alej`}>
	                    <div style={{ color: '#000' }}>
	                        {getLabel(2012, '对不起，您暂时没有权限！')}
	                    </div>
	                </WeaAlertPage>
	            </div>
			)
		}
	}
}